<div class="bjui-pageContent">
	<div class="pageFormContent" style="margin: 1px;" data-layout-h="0">
		<div style="margin: 15px auto 0; width: 900px;">
			<fieldset>
				<legend>安装说明</legend>
				<div class="pageFormContent" data-layout-h="0">
					<table class="table table-condensed table-hover" width="100%">
						<div class="wrap J_check_wrap">
							<div class="prompt_text" id="explanation">
								<div class="loading">loading...</div>
							</div>
						</div>
					</table>
				</div>
			</fieldset>
			<fieldset>
				<legend>在线安装日志</legend>
				<div class="pageFormContent" data-layout-h="0">
					<table class="table table-condensed table-hover" width="100%">
						<div class="prompt_text logs" id="record">
							<ul>
							</ul>
						</div>
						<div class="loading" style="display: none;">loading...</div>
					</table>
				</div>
			</fieldset>
			<button type="submit" class="btn-default" id="cloud_start" data-icon="play">开始安装</button>
		</div>
	</div>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
    </ul>
</div>
<script>
//请求
function getStep(url){
	$.getJSON(url,function(data){
		if(0 == data.code){
			$('#record ul').append('<li>'+data.message+'</li>');
			if(data.url){
				step(data.url);
			}else{
				$('div.loading').hide();
			}
		}else{
			$('#record ul').append('<li style="color:#F00">'+data.message+'</li>');
			$('div.loading').hide();
		}
	});
}
//获取使用说明
function getExplanation(identifier){
	$('#record ul').append('<li>获取模块安装使用说明....</li>');
	$.getJSON('{:url("instruction")}',{identifier:identifier},function(data){
		if(0 == data.code ){
			$('#record ul').append('<li>获取模块安装使用说明成功....</li>');
			$('#explanation').html(data.data);
		}else{
			$('#record ul').append('<li>获取模块安装使用说明异常【'+data.message+'】</li>');
			$('#cloud_start').hide();
		}
	});
}
function step(url){
	$('div.loading').show();
	getStep(url);
}
$(function(){
	getExplanation('{$identifier}');
	$('#cloud_start').click(function(){
		$(this).hide();
		$('#record ul').append('<li>开始执行安装....</li>');
		$('#record ul').append('<li>开始检查目录权限和下载安装包....</li>');
		step("{$stepUrl}");
	});
});
</script>
</body>
</html>